home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 005 / equity.arc / HGC.ASM < prev    next >
Encoding:
Assembly Source File  |  1987-02-17  |  2.0 KB  |  99 lines

  1. ;-------------------------------------------------------------------------
  2.  
  3. ;            H  G  C  .  C  O  M
  4.  
  5. ;-------------------------------------------------------------------------
  6. ;
  7. ; 4/1/86 NF    Version 1.0.  This program substitutes for Hercules program
  8. ;        of same name, but does not include "SAVE" command.
  9. ;        Use as follows:
  10. ;            "HGC DIAG" or "HGC DI"    to enter diagnostic mode
  11. ;            "HGC FULL" or "HGC FU"   to enter full memory mode
  12. ;            "HGC HALF" or "HGC HA"   to enter half memory mode
  13. ;         Note upper or lower case is permissible.
  14.  
  15. ;-------------------------------------------------------------------------
  16.  
  17.  
  18. herc_io        equ    03bfh        ; i/o port hercules memory select
  19.  
  20. ;-------------------------------------------------------------------------
  21. assume CS:code, DS:code
  22.  
  23. code    segment
  24.  
  25. org    80h
  26. command_length    db    (?)
  27. command_array    label    byte
  28.  
  29. org    100h
  30.  
  31. start:        jmp    go
  32.  
  33. epson_id    db    "Epson version 1.0",0dh,0ah
  34.  
  35.  
  36. go:        push    cs
  37.         pop    ds
  38.  
  39. ; for each character in command array, translate to lower case:
  40.  
  41.         xor    ch, ch    
  42.         mov    cl, [command_length]
  43.         jcxz    abort
  44.         mov    si, offset command_array
  45.  
  46. next:        mov    al, [si]
  47.         cmp    al, "A"
  48.         jb    not_upper
  49.         cmp    al, "Z"
  50.         ja    not_upper
  51.         add    al, 20h
  52.  
  53. not_upper:    mov    [si], al
  54.         inc    si
  55.         loop    next
  56.  
  57. ; for each character pair in command array, check for command:
  58.  
  59.         xor    ch, ch    
  60.         mov    cl, [command_length]
  61.         jcxz    abort
  62.         mov    si, offset command_array
  63.  
  64. next_char:    mov    ax, [si]
  65.  
  66. ;    Compare command first two letters only.
  67. ;    Note that string operator "xy" orders bytes as y low, x high.
  68.  
  69.         cmp    ax, "id"            ; "diag"
  70.         jz    diag_mode
  71.  
  72.         cmp    ax, "uf"            ; "full"
  73.         jz    full_mode
  74.  
  75.         cmp    ax, "ah"            ; "half"
  76.         jz    half_mode
  77.  
  78. ;    next character
  79.         inc    si
  80.         loop    next_char
  81.         jmp    abort
  82.  
  83. ; output to port
  84.  
  85. diag_mode:    mov    al,0
  86.         jmp    output
  87. full_mode:    mov    al, 3
  88.         jmp    output
  89. half_mode:    mov    al, 1
  90. output:        mov    dx, herc_io
  91.         out    dx, al
  92.  
  93. abort:    
  94.         mov    ah, 4ch        
  95.         int    21h        ; terminate with normal exit
  96.  
  97. code    ends
  98. end    start
  99.